#ifndef MAP_H
#define MAP_H

#include "entity.h"
#include "src/utils/dirlayout.h"
#include "src/common/be_model_system.h"

#include <boost/shared_ptr.hpp>

class Map : public Entity
{
	public:

		Map(entityType eType, boost::shared_ptr<btDynamicsWorld> ownerWorld);
		virtual ~Map();

		btTransform startgrid;
		btTransform finish;

		float finish_width;
		float finish_height;

		static boost::shared_ptr<Map> LoadMap(const char* mapname, boost::shared_ptr<btDynamicsWorld> ownerWorld);

		void LoadSkybox(const char* skyboxname);
		float m_skyBoxAngle;

		//boost::shared_ptr<Model> getModel() { return m_model; }
		//boost::shared_ptr<Model> getSkyboxmodel() { return m_skyBoxModel; }
		
		void update(const float timeDelta);
		void drawSkyBox();

		void setSkyBoxTransform(const btTransform& transform)
		{
			m_transform=transform;
		}

		void upload()
		{
			if(m_model)	m_model->upload();
			if(m_skyBoxModel) m_skyBoxModel->upload();
		}

	protected:
		virtual void load(const char* mapname) = 0;
		BeParser parseH;
		boost::shared_ptr<Model> m_model;
		boost::shared_ptr<Model> m_skyBoxModel;
		btTransform m_transform;

};

#endif
